/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package five.philosophers;

/**
 *
 * @author mateusz.ledzewicz
 */
public class FivePhilosophers {
    public static int numberOfPhilosophers = 5;
    public static int numberOfCycles = 100;
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       init();
       Checker checker = new Checker();
       checker.start();
       while(Thread.activeCount() > 2){
           
       }
       checker.run = false;
       
       for(Philosopher p : IdMemory.getPhilosophers())
       {
           System.out.println(p.getStatistic());
       } 
       
       
        
    }
    
    public static void init(){
        for(int i = 0; i< numberOfPhilosophers; i++){
            IdMemory.createFork();
        }
        
        for(int i = 0; i< numberOfPhilosophers; i++){
          IdMemory.createPhilosopher();
        }
        
    }
    
    
}
